import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '物料分类编码',
    align: 'center',
    dataIndex: 'code'
  },
  {
    title: '物料分类名称',
    align: 'left',
    dataIndex: 'name'
  },
  {
    title: '启用状态',
    align: 'center',
    dataIndex: 'enablestate',
    customRender:({text}) => {
       return render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}]);
    },
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '物料分类编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '物料分类名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '启用状态',
    field: 'enablestate',
     component: 'JSwitch',
     componentProps:{
     },
  },
  {
    label: '上级分类',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "bd_marbasclass,name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  code: {title: '物料分类编码',order: 0,view: 'text', type: 'string',},
  name: {title: '物料分类名称',order: 1,view: 'text', type: 'string',},
  enablestate: {title: '启用状态',order: 2,view: 'switch', type: 'string',},
};
